/*
 * Copyright (C) 2011 xjuraj
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package sk.lieskove.jianghongtiao.websearch.service;

/**
 * Reasons why to exclude document from the future processing.
 * 
 * @author xjuraj
 */
public enum ExcludeReasonEnum {
    
    ARES_NOT_FOUND("Not found in ARES system"),
    TOO_SMALL_FILE("Too small file"),
    TOO_LARGE_FILE("Too large file"),
    FILE_IS_NULL("File is null"),
    ORIGINAL_FILE_IS_NULL("Original file is null"),
    MIME_TYPE_NOT_SUPPORTED("Mime-Type of this document is not supported"),
    POI_NOT_SUPPORTED("POI cannot process this instance"),
    URL_ALREADY_FOUND("This URL was already found."),
    SURNAME_NOT_PRESENT("Surname of the person is not present in the file!");
    
    private final String value;
    
    ExcludeReasonEnum(String v) {
        value = v;
    }
    
    public String value() {
        return value;
    }
    
    public ExcludeReasonEnum fromValue(String v) {
        for (ExcludeReasonEnum c : ExcludeReasonEnum.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException("Value '" + v
                + "' is not correct value for type " + ExcludeReasonEnum.class.getName());
    }
    
    public boolean containsValue(String v) {
        for (ExcludeReasonEnum c : ExcludeReasonEnum.values()) {
            if (c.value.equals(v)) {
                return true;
            }
        }
        return false;
    }
}
